package utils

// ApiResponseStruct API 接口返回格式
type ApiResponseStruct struct {
	Code    int16       `json:"code"`
	Msg     string      `json:"msg"`
	Payload interface{} `json:"payload"`
}

// GetApiResponseOK API 接口的正常返回
func GetApiResponseOK(payload interface{}) *ApiResponseStruct {
	return GetApiResponse(200, "", payload)
}

// GetApiResponse API 接口的通用返回
func GetApiResponse(code int16, msg string, payload interface{}) *ApiResponseStruct {
	return &ApiResponseStruct{
		Code:    code,
		Msg:     msg,
		Payload: payload,
	}
}
